import React from 'react';
import ReactDOM from 'react-dom';
import {createStore, applyMiddleware, compose } from 'redux'
import thunk from 'redux-thunk'
import { Provider } from 'react-redux'
import {
  BrowserRouter,
  Route,
  // Link,
  Switch,
  // Redirect
} from 'react-router-dom'
import reducer from './reducer.js'
import Login from './container/login/login.js';
import Regiest from './container/regiest/regiest.js';
import Bossinfo from './container/bossinfo/bossinfo.js';
import Geniusinfo from './container/geniusinfo/geniusinfo.js';
import AuthRoute from './component/authRoute/authRoute'
import DashBoard from './component/dashboard/dashboard'
import './config'
import 'antd-mobile/dist/antd-mobile.css'
import './index.css'
// import registerServiceWorker from './registerServiceWorker';
// registerServiceWorker();

const reduxDevtools = window.devToolsExtension?window.devToolsExtension():f=>f

const store = createStore(reducer, compose(applyMiddleware(thunk),reduxDevtools))

console.log(store.getState())
ReactDOM.render(
    (<Provider store={store}>
      <BrowserRouter>
        <div>
          <AuthRoute></AuthRoute>
          <Switch>
             <Route path="/bossinfo" component={Bossinfo}></Route>
             <Route path="/geniusinfo" component={Geniusinfo}></Route>
             <Route path="/login" component={Login}></Route>
             <Route path="/regiest" component={Regiest}></Route>
             <Route  component={DashBoard}></Route>
           </Switch>
         </div>
      </BrowserRouter>
    </Provider>),
    document.getElementById('root')
  );

